<?php

/*
 * Action - Attack - Knight 5$
 * 
 * You may gain a card costing up to 3 Coin.
 * Each other player reveals the top 2 cards of his deck, trashes one of them costing from 3 Coin to 6 Coin, and discards the rest. If a Knight is trashed by this, trash this card.
 */

class DameNatalie extends Card implements iAction, iKingdom, iDarkAges, iKnight, iAttack {

    public function __construct() {
        parent::__construct("Dame Natalie", 5);
        $this->undoPlay = false;
        $this->undoBuy = false;
    }

    public function getDescription() {
        return array(
            "You may gain a card costing up to 3 Coin.",
            "Each other player reveals the top 2 cards of his deck, trashes one of them costing from 3 Coin to 6 Coin, and discards the rest. If a Knight is trashed by this, trash this card.");
    }

    public function play(Game $game, $isRealCard) {
        $game->attack($this);
        $options = array(new Option(1, "Yes"), new Option(2, "No"));
        $output = MySocket::GetUserReply($game, Input_ChooseOne, $options, 1, 1, null, "Gain card costing up to 3$?");
        if ($output[0] == "Yes") {
            $optional_cards = $game->getBoardCardsByPrice(new Price(), new Price(3));
            if (sizeof($optional_cards) > 0) {
                $output = MySocket::GetUserReply($game, Input_ChooseOne, $optional_cards, 1, 1, null, "Choose a card to gain");

                $new_card_name = $output[0];
                $new_card = $game->moveCardFromPileToPile($new_card_name, BoardCards, DiscardPile);
                ScreenDisplay::addScreenMessage($game, true, " gain " . nicePrint($new_card), " gains " . ScreenDisplay::$LMSG);
            }
        }

        $knight = new Knights();
        $knight->knightAttack($game, $this);
        $game->cardActionFinished();
    }

}

?>